home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-01-29 | 2.4 KB | 100 lines | [TEXT/IGR0] |
- | Version 1.01, 5/17/94
- | Used Wave/D instead of Wave in several places.
- | Version 1.10, 12/31/95
- | Updated for Igor Pro 3.0. Removed /D which is no longer needed.
-
- #pragma rtGlobals=1
-
- | RemoveOutliers(theWave, minVal, maxVal)
- | Removes all points in the wave below minVal or above maxVal.
- | Returns the number of points removed.
- Function RemoveOutliers(theWave, minVal, maxVal)
- Wave theWave
- Variable minVal, maxVal
-
- Variable p, numPoints, numOutliers
- Variable val
-
- numOutliers = 0
- p = 0 | the loop index
- numPoints = numpnts(theWave) | number of times to loop
-
- do
- val = theWave[p]
- if ((val < minVal) %| (val > maxVal)) | is this an outlier?
- numOutliers += 1
- else | if not an outlier
- theWave[p - numOutliers] = val | copy to input wave
- endif
- p += 1
- while (p < numPoints)
-
- | Truncate the wave
- DeletePoints numPoints-numOutliers, numOutliers, theWave
-
- return(numOutliers)
- End
-
- | RemoveNaNs(theWave)
- | Removes all points in the wave with the value NaN.
- | A NaN represents a blank or missing value.
- | Returns the number of points removed.
- Function RemoveNaNs(theWave)
- Wave theWave
-
- Variable p, numPoints, numNaNs
- Variable val
-
- numNaNs = 0
- p = 0 | the loop index
- numPoints = numpnts(theWave) | number of times to loop
-
- do
- val = theWave[p]
- if (numtype(val)==2) | is this NaN?
- numNaNs += 1
- else | if not NaN
- theWave[p - numNaNs] = val | copy to input wave
- endif
- p += 1
- while (p < numPoints)
-
- | Truncate the wave
- DeletePoints numPoints-numNaNs, numNaNs, theWave
-
- return(numNaNs)
- End
-
- | RemoveNaNsXY(theXWave, theYWave)
- | Removes all points in an XY pair if either wave has the value NaN.
- | A NaN represents a blank or missing value.
- | Returns the number of points removed.
- Function RemoveNaNsXY(theXWave, theYWave)
- Wave theXWave
- Wave theYWave
-
- Variable p, numPoints, numNaNs
- Variable xval, yval
-
- numNaNs = 0
- p = 0 | the loop index
- numPoints = numpnts(theXWave) | number of times to loop
-
- do
- xval = theXWave[p]
- yval = theYWave[p]
- if ((numtype(xval)==2) %| (numtype(yval)==2)) | either is NaN?
- numNaNs += 1
- else | if not an outlier
- theXWave[p - numNaNs] = xval | copy to input wave
- theYWave[p - numNaNs] = yval | copy to input wave
- endif
- p += 1
- while (p < numPoints)
-
- | Truncate the wave
- DeletePoints numPoints-numNaNs, numNaNs, theXWave, theYWave
-
- return(numNaNs)
- End
-